<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue3的例子</title>
</head>

<body>
    <div id="app">
        <h1 @click="add">{{state.count}} * 2 = {{double}}</h1>
    </div>
    <script src="https://unpkg.com/vue@next"></script>
    <script>
        const { reactive, computed } = Vue
        let App = {
            setup() {
                const state = reactive({
                    count: 1
                })
                function add() {
                    state.count++
                }
                const double = computed(() => state.count * 2)
                return { state, add, double }
            }
        }
        Vue.createApp(App).mount('#app')
    </script>
</body>

</html>